import * as React from 'react';
import SwiperItem from './SwiperItem';
import SwiperDots from './SwiperDots';
import './index.less';

interface Props {
    sliders: string[]
}
interface State {
    changeIndex: any
}

export default class HomeSwiper extends React.Component<Props, State> {
    changeIndex = (selectedIndex) => {
        (this.refs.swiperDots as any).changeIndex(selectedIndex)
    }
    render() {
        let { sliders } = this.props
        return (
            <div className="home-swipers">
                <SwiperItem sliders={sliders} changeIndex={this.changeIndex}/>
                <SwiperDots ref='swiperDots' sliders={sliders}/>
            </div>
        )
    }
}
